package com.gs.djys.callback;

import android.app.Activity;

import com.bigkoo.svprogresshud.SVProgressHUD;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.request.base.Request;

/**
* @Description: (带Dialog网络请求)
* @author 张成昆
* @date 2019-7-23
*/

public abstract class StringDialogCallback extends StringCallback {

    private final SVProgressHUD svProgressHUD;
    public StringDialogCallback(Activity activity) {
        svProgressHUD = new SVProgressHUD(activity);
    }

    @Override
    public void onStart(Request<String, ? extends Request> request) {
        if (!svProgressHUD.isShowing()) {
            svProgressHUD.showWithStatus("加载中...", SVProgressHUD.SVProgressHUDMaskType.Black);
        }
    }

    @Override
    public void onFinish() {
        if (svProgressHUD.isShowing()) {
            svProgressHUD.dismiss();
        }
    }
}
